<template>
  <div class='tinymce'>
    <Editor id="textarea" :init="myinit" v-model="content"></Editor>
  </div>
</template>

<script>
import Editor from '@tinymce/tinymce-vue'
export default {
  name: 'MyEditor',
  components: {
    Editor
  },
  data () {
    return {
      myinit: {
        selector: '#textarea',
        min_height: 400,
        language_url: '/tinymce/langs/zh_CN.js',
        language: 'zh_CN',
        plugins: 'autoresize link image hr lists code textcolor emoticons insertdatetime directionality',
        toolbar: [
          'fontselect | fontsizeselect | bold italic strikethrough underline | formatselect | alignleft aligncenter alignjustify alignright | copy image',
          'indent outdent blockquote | superscript subscript | hr code | numlist bullist | insertdatetime emoticons | forecolor backcolor | rtl lt | undo redo'
        ],
        images_upload_handler: function (blobInfo, success, failure) {
          const reader = new FileReader()
          reader.readAsDataURL(blobInfo.blob())
          reader.onload = function () {
            success(this.result)
          }
        },
        font_formats: "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings",
        statusbar: false
      },
      content: ''
    }
  }
}
</script>
<style>

</style>
